﻿using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace Network.Messages {
    public partial class MessageSerializer {

        static public Vector4 Read_Vector4( BinaryReader reader ) {
            return new Vector4( reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() );
        }

        static public Vector3 Read_Vector3( BinaryReader reader ) {
            return new Vector3( reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() );
        }

        static public Quaternion Read_Quaternion( BinaryReader reader ) {
            return new Quaternion( reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle() );
        }

        static public Vector2 Read_Vector2( BinaryReader reader ) {
            return new Vector2( reader.ReadSingle(), reader.ReadSingle() );
        }

        static public void Write_Quaternion( BinaryWriter writer, Quaternion value ) {
            writer.Write( value.x );
            writer.Write( value.y );
            writer.Write( value.z );
            writer.Write( value.w );
        }

        static public void Write_Vector4( BinaryWriter writer, Vector4 value ) {
            writer.Write( value.x );
            writer.Write( value.y );
            writer.Write( value.z );
            writer.Write( value.w );
        }

        static public void Write_Vector3( BinaryWriter writer, Vector3 value ) {
            writer.Write( value.x );
            writer.Write( value.y );
            writer.Write( value.z );
        }

        static public void Write_Vector2( BinaryWriter writer, Vector2 value ) {
            writer.Write( value.x );
            writer.Write( value.y );
        }
    }
}
